{literal}
<script type="text/javascript">

	$(document).ready(function(){

	function liFormat (row, i, num) {
		var result = row[0];
		return result;
	}

	function selectItem(li) {
		if( li == null ) var sValue = 'Nothing Selected!';
		if( !!li.extra ) var sValue = li.extra[2];
		else var sValue = li.selectValue;
		alert("Selected ID: " + sValue);
	}

	$("input#{/literal}{$id|replace:':':'\\\\:'}{literal}").autocomplete("{/literal}{$GLOBALS.site_url}/autocomplete/{if $complexField}{$complexField}:{/if}{$id}/{if $form_fields.$id.type}{$form_fields.$id.type}{else}text{/if}/{if $form_fields.$id.is_classifieds != 1}users{else}listings{/if}/{if $complexField}1/{/if}{literal}", {
		delay:10,
		minChars:{/literal}{if $GLOBALS.settings.min_autocomplete_symbols_quantity}{$GLOBALS.settings.min_autocomplete_symbols_quantity}{else}1{/if}{literal},
		matchSubset:1,
		autoFill:true,
		width: 300,
		matchContains:1,
		cacheLength:1,
		selectFirst:true,
		formatItem:liFormat,
		maxItemsToShow:5,
		onItemSelect:selectItem
		})
	}); 

</script>
{/literal}